import 'dart:io';

import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
// import 'package:flutter_pdfview/flutter_pdfview.dart';


Future<void> main() async {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // onGenerateRoute:defaultOnGenerateRoute,
      home: Scaffold(
          appBar: AppBar(
            title: Text("Flutter Demo"),
          ),
          body: Center(
            child: ListView(
              children: const [
                MyDialog(),
              ],
            ),
          )),
      // routes: routes,
      // initialRoute: "/",
    );
  }
}

class MyDialog extends StatefulWidget {
  const MyDialog({Key? key}) : super(key: key);

  @override
  _MyDialogState createState() => _MyDialogState();
}

class _MyDialogState extends State<MyDialog> {
  @override
  Widget build(BuildContext context) {
    return Center(
        child: ElevatedButton(

            onPressed: () async{
              getApplicationDocumentsDirectory().then((value) => print(value));
              getExternalStorageDirectory().then((value) => print(value));
              getExternalCacheDirectories().then((value) => print(value));
              // getDownloadsDirectory().then((value) => print(value));
              getTemporaryDirectory().then((value) => print(value));
              // getLibraryDirectory().then((value) => print(value));
              getApplicationSupportDirectory().then((value) => print(value));
              var d = await getApplicationDocumentsDirectory();
              var r = await showDialog(
                  context: context,
                  builder: (context) => AlertDialog(
                        title: const Text("alert title"),
                        content: const Text("content"),
                        actions: [
                          ElevatedButton(
                              onPressed: () {
                                Navigator.pop(context,"Noo  $d");
                              }, child: const Text("确定")),
                        ],
                      ));
              print(r);
              // getApplicationSupportDirectory().then((value) => print(value));
              // getDownloadsDirectory().then((value) => print(value));


            },
            child: const Text("dialog")));
  }
}
